import Vue from "vue";
import Router from "vue-router";
import { project } from "../../config";
Vue.use(Router);

const routes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    name: "login",
    meta: {
      title: "shop",
    },
    component: () => import("../view/login/login")
  },
  {
    path: "/address",
    name: "address",
    meta: {
      title: "address",
    },
    component: () => import("../view/address")
  },
  {
    path: "/applyfor",
    name: "applyfor",
    meta: {
      title: "applyfor",
    },
    component: () => import("../view/subpage/applyfor")
  },
  {
    path: "/download",
    name: "download",
    meta: {
      title: "download",
    },
    component: () => import("../view/subpage/download")
  },
  {
    path: "/list",
    name: "list",
    meta: {
      title: "list",
    },
    component: () => import("../view/subpage/list")
  },
  {
    path: "/writemessage",
    name: "liswritemessage",
    meta: {
      title: "writemessage",
    },
    component: () => import("../view/subpage/writemessage")
  }




];
const router = new Router({
  mode: "history",
  base: project.base,
  routes
});



 
router.afterEach((route) => {
  //全局前置路由守卫
  const meta = route.meta || {};
  const { title } = meta;
  if (title) {
    document.title = title;
  }
});

export default router;
